GBML manual / Audio

music_fade_to

Fades whatever is currently audible out, then fades m in - one Direct Sound channel, so this is always sequential, never a true overlap.

Syntax

music_fade_to(m, loop, volume)

Arguments

NameType
msong
loopbool
volumereal

Returns

Nothing.

Description

Fades whatever is currently audible out, then fades m in - there is only one Direct Sound channel, so this is always sequential (fade out, then fade in), never a true overlap of two songs. A no-op if m is already playing, or already the target of an in-progress fade, at the same volume - re-requesting the same song (two rooms that happen to share one, say) changes nothing, which is exactly what makes moving between such rooms transparent instead of restarting the song on every crossing. Asking for the same song at a different volume keeps the song going and moves its volume to the new one (up with the fade-in, down at once).

Example

music_fade_to(song_doc_theme, true, 1);

Crossfades to the theme, looping, at full volume - the usual call for a room's own song setting, made once from that room's creation code.

On the GBA

A complete no-op if m is already playing or already the target of an in-progress fade - re-requesting the same song (e.g. two rooms sharing one) changes nothing, so leaving one room for another mapped to the same song is transparent. `music_fade_to(nothing, ...)` fades out to silence (no song to fade in to).

See also: music_playmusic_stopmusic_currentmusic_fadingmusic_volume